#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=5e6+100;
typedef long long LL;
typedef unsigned long long ull;
///const LL mod=1e9+7;
const int base=131;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
char str[maxn],a[maxn];
int sum1[maxn],val[maxn],p[maxn];
int len[maxn];
LL dp[maxn];
int cal(int l,int r){
    return (sum1[r]-(sum1[l-1]*p[r-l+1]) );
}
int main(void)
{
  int n;scanf("%d",&n);scanf("%s",str+1);
  p[0]=1;
  int length=strlen(str+1);
  for(int i=1;i<=length;i++){
    p[i]=(p[i-1]*base);
    sum1[i]=(sum1[i-1]*base+str[i]);
  }
  for(int i=1;i<=n;i++){
    scanf("%s",a+1);
    len[i]=strlen(a+1);
    int ans=0;
    for(int j=1;j<=len[i];j++){
        ans=(ans*base+a[j]);
    }
    val[i]=ans;
  }
  dp[0]=1;
  for(int i=1;i<=n;i++){
    ///if(cal(1,1+len[i]-1)==val[i]) dp[len[i]]+=1;
    for(int j=length;j>=len[i];j--){
        if(val[i]==cal(j-len[i]+1,j)){
            dp[j]+=dp[j-len[i]];
        }
    }
  }
  printf("%lld\n",dp[length]);
return 0;
}

